/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action;

import controller.Action;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.Operacao;
import persistense.ContaDAO;
import strategy.OperacaoExtrato;

/**
 *
 * @author Aurelio
 */
public class ExtratoAction implements Action{
    private static final String EXTRATO = "extrato.jsp";
    
    @Override
    public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException {
        try {
            String numeroConta = request.getParameter("numero_conta");  
            Operacao op = new OperacaoExtrato();
            List<OperacaoExtrato> historico = ContaDAO.getInstance().recuperaHistorico(numeroConta);
            request.getSession().setAttribute("historico",historico );
            
            response.sendRedirect(EXTRATO);
            
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
